#!/bin/bash
echo "------Shell Demo Test------"
name="xueqian"
date="2019.6.5"
echo "name= "${name}
echo "date= "$date

#---------注释行---------#
:<<!
1
2
3
4
!
#---------注释行---------#

date

ls -l

array=(A,B,"C",'D')
array[0]=A
array[1]=B
array[2]=C
array[3]=D
echo "数组元素为：${array[*]}"
echo "数组个数为：${#array[*]}"

val=`expr 10 \* 10`
echo "10*10= "$val

a=10
b=20

if [ $a != $b ]
then
    echo "$a != $b"
else
    echo "$a == $b"
fi

s1="abc"
s2="dfg"
s3=""

if [ $s1 = $s2 ]; then echo "$s1 = $s2"; else echo "$s1 != $s2"; fi
if [ $s3 ]; then echo "s3不为空"; else echo "s3为空"; fi

echo -e "\n" #newline
echo echo test //no \"\" still print
echo -e "\n" #newline

func(){
for loop in 1 2 3 4 5 6
do
  echo "loop-$loop"
done
}

echo "func-print:"
func

echo "current shell pid = "$$

read name
echo print: $name






